import Vue from 'vue'
import VueRouter from 'vue-router'
// import Home from '../views/Home.vue'
Vue.use(VueRouter)

const routes = [{
    path: '/',
    name: 'login',
    component: resolve => require(['../views/Login.vue'], resolve)
  },
  {
    path: '/index',
    redirect: {
      name: '首页',
    },
    component: resolve => require(['../components/index.vue'], resolve),
    children: [{
      path: '/index',
      name: '首页',
      component: resolve => require(['../views/index/index.vue'], resolve)
    }]
  },
  {
    path: '/agentManagement',
    name: '代理商管理',
    component: resolve => require(['../components/index.vue'], resolve),
    children: [{
      path: '/agentManagement',
      name: '代理商管理',
      component: resolve => require(['../views/agentManagement/agentManagement.vue'], resolve)
    }]
  },
  {
    path: '/staffManagement',
    name: '员工管理',
    component: resolve => require(['../components/index.vue'], resolve),
    children: [{
      path: '/staffManagement',
      name: '员工管理',
      component: resolve => require(['../views/staffManagement/staffManagement.vue'], resolve)
    }]
  }

  // {
  //   path: '/about',
  //   name: 'About',
  //   // route level code-splitting
  //   // this generates a separate chunk (about.[hash].js) for this route
  //   // which is lazy-loaded when the route is visited.
  //   component: () => import(/* webpackChunkName: "about" */ '../views/About.vue')
  // }
]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router